import Loadable from 'react-loadable';
import { RouteConfig } from 'react-router-config';
import Loading from '../components/loading';

const routes: RouteConfig[] = [
  {
    path: '/login',
    exact: true,
    component: Loadable({
      loader: () => import('../pages/login'),
      loading: Loading,
    }),
  },
  {
    path: '/',
    component: Loadable({
      loader: () => import('../layout/default'),
      loading: Loading,
    }),
    routes: [
      {
        path: '/detail',
        exact: true,
        component: Loadable({
          loader: () => import('../pages/detail'),
          loading: Loading,
        }),
      },
      {
        path: '/joke',
        exact: true,
        component: Loadable({
          loader: () => import('../pages/joke'),
          loading: Loading,
        }),
      },
    ],
  },
];

export default routes;
